package com.heima.minio.test;


import com.heima.file.service.FileStorageService;
import com.heima.minio.MinIOApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest(classes = MinIOApplication.class)
@RunWith(SpringRunner.class)
public class MinIOTest2 {

    @Autowired
    private FileStorageService fileStorageService;


    @Test
    public void test() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("E:\\tmp\\ak47.jpg");
        String url = fileStorageService.uploadImgFile("", "1234567899.jpg", fileInputStream);
        System.out.println(url);
    }

    @Test
    public void  testDel(){
        fileStorageService.delete("http://192.168.200.130:9000/leadnews/2021/11/01/1234567899.jpg");
    }


}
